function dataout = runrho11(x,fup12,fid,year,a,b,c,svshare,N,fid2yr,omega1,abc,x0_1_1,x0_1_2,x0_1_3,x0_1_4)
    %solve for rho three times (i)  - (omega, omega-unit, omega-pnic2-unit)
    %use 4 starting values (o)
    options = optimset('Display','off','MaxIter',5e5,'MaxFunEvals',5e5,'TolFun',1e-6,'TolX',1e-6);
    %lb = [-Inf ; zeros(N,1)];
    %ub = [Inf;    ones(N,1)];
    lb = [-Inf ; ones(N,1)*.01];
    ub = [Inf;    ones(N,1)*.99];
    A = [0 ones(1,N)];
    
    for i = 1:1
        for o = 1:4
            funceval   = ['func = @(x) rho_solve11(x,omega' int2str(i) ',abc);'];
                eval(funceval);
            %opt  = ['[xx' int2str(i) '_' int2str(o) ' fvalx' int2str(i) '_' int2str(o) ' resx' int2str(i) '_' int2str(o) ' exitx' int2str(i) '_' int2str(o) '] = lsqnonlin(func,x0_' int2str(i) '_' int2str(o) ',lb,ub,options);'];
            opt  = ['[xx' int2str(i) '_' int2str(o) ' fvalx' int2str(i) '_' int2str(o) ' exitx' int2str(i) '_' int2str(o) '] = fmincon(func,x0_' int2str(i) '_' int2str(o) ',[],[],A,1,lb,ub,[],options);'];
                eval(opt);
            expo = ['xx' int2str(i) '_' int2str(o) '(2:end) = xx' int2str(i) '_' int2str(o) '(2:end);'];
                eval(expo);
            %normval = ['fvalx' int2str(i) '_' int2str(o) ' = norm(fvalx' int2str(i) '_' int2str(o) ');'];
                %eval(normval);
            clear func
        end
    end
    %
    
    BUILD = [];
    for i = 1:1
    for o = 1:4
            build = ['[omega' int2str(i) ' repmat(xx' int2str(i) '_' int2str(o) '(1),N,1) xx' int2str(i) '_' int2str(o) '(2:end) repmat(fvalx' int2str(i) '_' int2str(o) ',N,1) repmat(exitx' int2str(i) '_' int2str(o) ',N,1)]'];
            BUILD = [BUILD eval(build)];
        end
    end
        
     dataout = [fup12 year repmat(x,N,1) svshare BUILD];
     dir = ['x_rhos' int2str(x) '.csv'];
     csvwrite(dir,dataout);
end
